<?php

/*
 * 工作计划视图
 */

class ActivemanageViewModel extends ViewModel {

    var $sql;

    function _initialize() {
        $this->viewFields[] = array(
            '_table' => TABLE_ACTIVE_ACTIVE_NAME,
            '_field' => array(
                'id',
                'active_type_id',
                'active_status_id',
                'title',
                'content',
                'img',
                'image',
                'b_time',
                'e_time',
                'time',
                'praise',
                'address',
                'money',
                'number',
                'status',
                'sponsor',
                'sort',
                'groupid'
            ),
            '_alias' => 'a'
        );
        $this->viewFields[] = array(
            '_table' => TABLE_SOURCE_BASIC_FIELD,
            '_field' => array(
                'name' => 'active_type'
            ),
            '_alias' => 'b',
            '_on' => '`a`.`active_type_id` = concat(`b`.`group_id`,`b`.`id`)',
            '_type' => 'left'
        );
        $this->viewFields[] = array(
            '_table' => TABLE_SOURCE_BASIC_FIELD,
            '_field' => array(
                'name' => 'active_status'
            ),
            '_alias' => 'c',
            '_on' => '`a`.`active_status_id` = concat(`c`.`group_id`,`c`.`id`)',
            '_type' => 'left'
        );
//        $this->viewFields[] = array(
//            '_table' => TABLE_USER,
//            '_field' => array(
//                'nickname' => 'user_name'
//            ),
//            '_alias' => 'd',
//            '_on' => '`a`.`user_id` = `d`.`id`',
//            '_type' => 'left'
//        );
        parent::_initialize();
    }

}
